package com.bw.demoseckill.controller;


import com.bw.demoseckill.service.AdminService;
import com.bw.demoseckill.service.GoodsService;
import com.bw.demoseckill.utils.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author Administrator
 */
@RestController
@RequestMapping("goods")
@Slf4j
@CrossOrigin
public class GoodsController {

    @Autowired
    private AdminService adminService;

    @Autowired
    private GoodsService goodsService;

    /**
     * TODO 范欣宜 开始活动
     * @Author: 范欣宜
     * @Date: 2020/10/29 11:52
     * @param userId:
     * @return: com.bw.demoseckill.common.resp.ResponseResult
     **/
    @PostMapping(value = "/doBeginGrab")
    public ResponseResult doBeginGrab(
            @RequestParam("userId") Integer userId) {
        return goodsService.doBeginGrab(userId);
    }


    /**
     * TODO 范欣宜 抢购
     * @Author: 范欣宜
     * @Date: 2020/10/29 11:52
     * @param id:
     * @return: com.bw.demoseckill.common.resp.ResponseResult
     **/
    @PostMapping("/grabClass")
    public ResponseResult grabMarketClass(@RequestParam("id") Integer id){

        return goodsService.grabClass(id);
    }

}
